package cn.bb.bbstudy.dao;

import cn.bb.bbstudy.pojo.Blog;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface BlogDAO {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(Blog record);

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(Blog record);

    /**
     * select by primary key
     * @param id primary key
     * @return object by primary key
     */
    Blog selectByPrimaryKey(Integer id);

    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(Blog record);

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(Blog record);

    int count(String uid);

    Page<Blog> findAllByUIdDesc(String uid);

    Page<Blog> findAllDesc();

    //根据博客id 查询博客
    Blog findOneByBid(String bid);

    //根据分类累出所有博客
    Page<Blog> findAllByCIdDesc(int cid);
}